{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">编辑样本信息</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label class="form-label">样本编号</label>
                            <input type="text" class="form-control" value="{{ storage.sample_code }}" readonly>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">选择仓库</label>
                            <select class="form-select" name="warehouse_id" required>
                                {% for warehouse in warehouses %}
                                <option value="{{ warehouse.id }}" {% if warehouse.id == storage.warehouse_id %}selected{% endif %}>
                                    {{ warehouse.name }} (温度:{{ warehouse.temperature }}°C, 湿度:{{ warehouse.humidity }}%)
                                </option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">样本类型</label>
                            <select class="form-select" name="sample_type" required>
                                <option value="tissue" {% if storage.sample_type == 'tissue' %}selected{% endif %}>组织样本</option>
                                <option value="blood" {% if storage.sample_type == 'blood' %}selected{% endif %}>血液样本</option>
                                <option value="dna" {% if storage.sample_type == 'dna' %}selected{% endif %}>DNA样本</option>
                                <option value="rna" {% if storage.sample_type == 'rna' %}selected{% endif %}>RNA样本</option>
                                <option value="protein" {% if storage.sample_type == 'protein' %}selected{% endif %}>蛋白质样本</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">数量</label>
                            <input type="number" class="form-control" name="quantity" 
                                   value="{{ storage.quantity }}" step="0.01" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">存储位置</label>
                            <input type="text" class="form-control" name="storage_location" 
                                   value="{{ storage.storage_location }}"
                                   placeholder="例如: A-01-02 (货架号-层号-位置号)" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">温度要求(°C)</label>
                            <input type="number" class="form-control" name="temperature_requirement" 
                                   value="{{ storage.temperature_requirement }}" step="0.1" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">湿度要求(%)</label>
                            <input type="number" class="form-control" name="humidity_requirement" 
                                   value="{{ storage.humidity_requirement }}" step="0.1" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">状态</label>
                            <select class="form-select" name="status" required>
                                <option value="stored" {% if storage.status == 'stored' %}selected{% endif %}>已入库</option>
                                <option value="in_transit" {% if storage.status == 'in_transit' %}selected{% endif %}>运输中</option>
                                <option value="delivered" {% if storage.status == 'delivered' %}selected{% endif %}>已送达</option>
                            </select>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">保存修改</button>
                            <a href="{{ url_for('storage.storage_list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 